﻿using System;
using System.Collections.Generic;
using System.Configuration;
using System.Globalization;
using System.Linq;
using System.Threading;
using System.Windows.Forms;

namespace Curriculum
{
    static class Program
    {
        /// <summary>
        /// The main entry point for the application.
        /// </summary>
        [STAThread]
        static void Main()
        {
            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);
            Thread.CurrentThread.CurrentUICulture = new CultureInfo("pt-PT");
            var licenseKey = ConfigurationManager.AppSettings["LicenseKey"];
            if (!E4RPLicense.License.Validate(E4RPTools.Product.Curriculum.ToString(), (long)E4RPTools.Product.Curriculum, 1, licenseKey))
                return;
            var controller = new BackOfficeController();
            var user = ConfigurationManager.AppSettings["User"];
            var password = ConfigurationManager.AppSettings["Password"];
            if (!controller.IsUserValid(user, password))
                return;
            var main = new MainRibbonForm() { Controller = controller };
            Application.Run(main);
        }
    }
}
